using System;
using System.Collections;
using Sedna.Core.Persistence;

namespace Sedna.Core.Persistence
{
	/// <summary>
	/// a simple implementation of the IQueryResult interface
	/// that stores the collection of data that represent a result
	/// and their corresponding count.
	/// </summary>
	public class QueryResult : IQueryResult
	{
		private ICollection data;
		private int totalCount;
		private bool isTotalCountDefined;

		public QueryResult()
		{
			this.isTotalCountDefined = false;
		}

		public QueryResult(ICollection data)
		{
			this.data = data;
			this.isTotalCountDefined = false;
		}

		public QueryResult(ICollection data, int totalCount)
		{
			this.data = data;
			this.totalCount = totalCount;
			this.isTotalCountDefined = true;
		}

		public ICollection Data
		{
			get { return data; }
			set { data = value; }
		}

		public int TotalCount
		{
			get { return totalCount; }
			set { totalCount = value; }
		}

		public bool IsTotalCountDefined
		{
			get { return isTotalCountDefined; }
			set { isTotalCountDefined = value; }
		}

	}
}
